/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CharacterBuilder1.java
 *
 * Created on 26/10/2011, 16:57:08
 */
package clientApp;

import java.util.ArrayList;

import javax.swing.JOptionPane;

import clientApp.utils.RPG_Workstation_Container;

import game.units.Attribute;
import game.units.Character;

import game.enums.Alignment;
import game.enums.Size;

import game.referenceValues.*;

/**
 *
 * @author Gabriel
 */
@SuppressWarnings("serial")
public class CharacterBuilder1 extends javax.swing.JPanel {

	
	RPG_Workstation_Container container;
	private Character character;
	private ArrayList<Race> races = new ArrayList<Race>();
	String[] aligns = new String[9];
	String[] sizes = new String[4];
	Alignment[] alignEnum = Alignment.values();
	Size[] sizeEnum = Size.values();
	boolean isNewChar = false;
	
    /** Creates new form CharacterBuilder1 */
    public CharacterBuilder1(RPG_Workstation_Container rpg_Workstation_Container, Character character, boolean isNewChar) {
    	this.character = character;
    	container = rpg_Workstation_Container;
    	this.isNewChar = isNewChar;
    	initObjects();
        initComponents();
        initComponentsValues();
    }
    
    private void initComponentsValues() {
		if(character.getName() != null)
		{			
			jTFAge.setText(String.valueOf(character.getAge()));
			jCBSIZE.setSelectedIndex(character.getAlignment().ordinal());
			jTFCurrentRace.setText(character.getRace().getName());
			jTFDeity.setText(character.getDeity());
			jTFGender.setText(character.getGender());
			jTFHeight.setText(String.valueOf(character.getHeight()));
			jTFName.setText(character.getName());			
			jTARaceDetails.setText(character.getRace().getDescription());
			jCBAlignment.setSelectedIndex(character.getSize().ordinal());
			jTFWeight.setText(String.valueOf(character.getWeight()));
			character.setExperience(0);
		}
		
	}

	private void initObjects()
    {		
		for (int i = 0; i < alignEnum.length; i++ ) 	
		{
			aligns[i] = alignEnum[i].name();
		}
		for (int i = 0; i < sizeEnum.length; i++ ) 	
		{
			sizes[i] = sizeEnum[i].name();
		}
		Race raceGetter = new Race();
		races = raceGetter.getRaces();
	}

    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel2 = new javax.swing.JLabel();
        jTFName = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jTFGender = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jTFDeity = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jTFHeight = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jTFWeight = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jTFAge = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jSeparator3 = new javax.swing.JSeparator();
        jLabel10 = new javax.swing.JLabel();
        jSeparator4 = new javax.swing.JSeparator();
        jSeparator5 = new javax.swing.JSeparator();
        jScrollPane1 = new javax.swing.JScrollPane();
        jLRaces = new javax.swing.JList();
        jBSelectRace = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        jTFCurrentRace = new javax.swing.JTextField();
        jSeparator6 = new javax.swing.JSeparator();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTARaceDetails = new javax.swing.JTextArea();
        jBViewRace = new javax.swing.JButton();
        jLabel12 = new javax.swing.JLabel();
        jBNext = new javax.swing.JButton();
        jCBAlignment = new javax.swing.JComboBox();
        jCBSIZE = new javax.swing.JComboBox();

        jPanel1.setBackground(new java.awt.Color(0, 0, 102));

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 28));
        jLabel1.setForeground(new java.awt.Color(255, 255, 255));
        jLabel1.setText("Character Details");

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("Name:");

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel3.setForeground(new java.awt.Color(255, 255, 255));
        jLabel3.setText("Gender:");

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setText("Size:");

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel5.setForeground(new java.awt.Color(255, 255, 255));
        jLabel5.setText("Deity:");

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel6.setForeground(new java.awt.Color(255, 255, 255));
        jLabel6.setText("Height:");

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel7.setForeground(new java.awt.Color(255, 255, 255));
        jLabel7.setText("Weight:");

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel8.setForeground(new java.awt.Color(255, 255, 255));
        jLabel8.setText("Age:");

        jLabel9.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel9.setForeground(new java.awt.Color(255, 255, 255));
        jLabel9.setText("Alignment:");

        jLabel10.setFont(new java.awt.Font("Tahoma", 0, 28));
        jLabel10.setForeground(new java.awt.Color(255, 255, 255));
        jLabel10.setText("Character Race");

        
        jLRaces.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLRaces.setModel(new javax.swing.AbstractListModel() {
        	ArrayList<Race> locaRaces = races;
            public int getSize() { return locaRaces.size(); }
            public Object getElementAt(int i) { return locaRaces.get(i).getName(); }
        });
        jScrollPane1.setViewportView(jLRaces);

        jBSelectRace.setText("Select");
        jBSelectRace.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBSelectRaceActionPerformed(evt);
            }
        });

        jLabel11.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel11.setForeground(new java.awt.Color(255, 255, 255));
        jLabel11.setText("Current Race:");

        jTFCurrentRace.setEditable(false);
        jTFCurrentRace.setFont(new java.awt.Font("Tahoma", 0, 12));        

        jTARaceDetails.setColumns(20);
        jTARaceDetails.setRows(5);
        jTARaceDetails.setEnabled(false);
        jTARaceDetails.setDisabledTextColor(jTARaceDetails.getForeground());
        jScrollPane2.setViewportView(jTARaceDetails);        

        jBViewRace.setText("View Race Details");
        jBViewRace.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBViewRaceActionPerformed(evt);
            }
        });

        jLabel12.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel12.setForeground(new java.awt.Color(255, 255, 255));
        jLabel12.setText("Race Details:");

        jBNext.setText("Next");
        jBNext.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBNextActionPerformed(evt);
            }
        });

        jCBAlignment.setModel(new javax.swing.DefaultComboBoxModel(aligns));

        jCBSIZE.setModel(new javax.swing.DefaultComboBoxModel(sizes));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 750, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 534, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel5)
                            .addComponent(jLabel8))
                        .addGap(12, 12, 12)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jTFName, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel3))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jTFDeity, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel6))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jTFAge, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel9)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jCBAlignment, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jTFHeight, javax.swing.GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE)
                            .addComponent(jTFGender, javax.swing.GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel7)
                            .addComponent(jLabel4))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jCBSIZE, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jTFWeight, javax.swing.GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 123, Short.MAX_VALUE))
                    .addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 750, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jSeparator4, javax.swing.GroupLayout.DEFAULT_SIZE, 557, Short.MAX_VALUE))
                    .addComponent(jSeparator5, javax.swing.GroupLayout.DEFAULT_SIZE, 750, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jLabel12)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jBViewRace))
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jBSelectRace)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel11)
                                    .addComponent(jTFCurrentRace, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addComponent(jSeparator6, javax.swing.GroupLayout.DEFAULT_SIZE, 316, Short.MAX_VALUE)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                .addComponent(jBNext, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(19, 19, 19)))))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(jTFName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTFGender, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4)
                    .addComponent(jCBSIZE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTFDeity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(jTFHeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7)
                    .addComponent(jTFWeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTFAge, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8)
                    .addComponent(jLabel9)
                    .addComponent(jCBAlignment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel10)
                    .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jBViewRace, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel12)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jBSelectRace)
                            .addComponent(jTFCurrentRace, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
                    .addComponent(jBNext))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 780, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(20, 20, 20))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 446, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(22, 22, 22))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jBSelectRaceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBSelectRaceActionPerformed
    	
    	character.setRace(races.get(jLRaces.getSelectedIndex()));
    	generateAttributes();
    	jTFCurrentRace.setText(jLRaces.getSelectedValue().toString());
    }

    private void jBViewRaceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBViewRaceActionPerformed
    	
    	if(jLRaces.getSelectedValue() != null)
    	{
    		jTARaceDetails.setText(races.get(jLRaces.getSelectedIndex()).getDescription());  
    	}
    		
    }

    private void jBNextActionPerformed(java.awt.event.ActionEvent evt) {                                       
    	try{
	        character.setDeity(jTFDeity.getText()); 
	        character.setGender(jTFGender.getText()); 
	        character.setName(jTFName.getText());         
	        character.setWeight(jTFWeight.getText());    
	        character.setHeight(jTFHeight.getText());
	        try{
		        character.setAge(Integer.parseInt(jTFAge.getText()));
		        character.setAlignment(alignEnum[jCBAlignment.getSelectedIndex()]);  
		        character.setSize(sizeEnum[jCBSIZE.getSelectedIndex()]); 
		        character.getRace().setinitialSkillsValues(character);
		        container.add(new CharacterBuilder2(container, character, new UnitClass(),isNewChar), "CharacterBuilder2");
		        container.panels.show(container, "CharacterBuilder2");
	        }
	        catch (Exception e)
	    	{
				JOptionPane.showMessageDialog(null, "Age must be a number.");
			} 	        
    	}
    	catch (Exception e)
    	{
			JOptionPane.showMessageDialog(null, "Please, fill the character form.");
		}    	
        
    }
    
    private void generateAttributes()
    {
    	ArrayList<Attribute> atts = new ArrayList<Attribute>();
    	int strBonus = (character.getRace().getModifiers().get("Str")!=null)?character.getRace().getModifiers().get("Str") : 0;
    	int conBonus = (character.getRace().getModifiers().get("Con")!=null)?character.getRace().getModifiers().get("Con") : 0;
    	int dexBonus = (character.getRace().getModifiers().get("Dex")!=null)?character.getRace().getModifiers().get("Dex") : 0;
    	int intBonus = (character.getRace().getModifiers().get("Int")!=null)?character.getRace().getModifiers().get("Int") : 0;
    	int wisBonus = (character.getRace().getModifiers().get("Wis")!=null)?character.getRace().getModifiers().get("Wis") : 0;
    	int chaBonus = (character.getRace().getModifiers().get("Cha")!=null)?character.getRace().getModifiers().get("Cha") : 0;
    	
    	
    	Attribute str = new Attribute("Strength");
    	str.setValue(8 + strBonus);
    	str.setModifier(Attribute.modifierValue(str.getValue()));
    	atts.add(str);
    	
    	Attribute cons = new Attribute("Constitution");
    	cons.setValue(8 + conBonus);
    	cons.setModifier(Attribute.modifierValue(cons.getValue()));
    	atts.add(cons);
    	
    	Attribute dex = new Attribute("Dexterity");
    	dex.setValue(8 + dexBonus);
    	dex.setModifier(Attribute.modifierValue(dex.getValue()));
    	atts.add(dex);
    	
    	Attribute inte = new Attribute("Intelligence");
    	inte.setValue(8 + intBonus);
    	inte.setModifier(Attribute.modifierValue(inte.getValue()));
    	atts.add(inte);
    	
    	Attribute wis = new Attribute("Wisdom");
    	wis.setValue(8 + wisBonus);
    	wis.setModifier(Attribute.modifierValue(wis.getValue()));
    	atts.add(wis);
    	
    	Attribute chari = new Attribute("Charisma");
    	chari.setValue(8 + chaBonus);
    	chari.setModifier(Attribute.modifierValue(chari.getValue()));
    	atts.add(chari);
    	character.setAttributes(atts);
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBNext;
    private javax.swing.JButton jBSelectRace;
    private javax.swing.JButton jBViewRace;
    private javax.swing.JComboBox jCBSIZE;
    private javax.swing.JComboBox jCBAlignment;
    private javax.swing.JList jLRaces;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JSeparator jSeparator5;
    private javax.swing.JSeparator jSeparator6;
    private javax.swing.JTextArea jTARaceDetails;
    private javax.swing.JTextField jTFAge;
    private javax.swing.JTextField jTFCurrentRace;
    private javax.swing.JTextField jTFDeity;
    private javax.swing.JTextField jTFGender;
    private javax.swing.JTextField jTFHeight;
    private javax.swing.JTextField jTFName;
    private javax.swing.JTextField jTFWeight;
    // End of variables declaration//GEN-END:variables
}
